<?php
namespace app\admin\controller;
use think\Controller;
class Activity extends Base
{
    public function release()
    {
    $activity=\think\Loader::model('Activity');
    $data['activityType'] = $activity->getActivityTyle();
    $data['educationalType']=$activity->getEducationalType();
    $data['jobsType']=$activity->getJobsType();
    $data['scaleMode']=$activity->getScaleMode();
    return view(null,$data);
    }
    public function halllist()
    {
    $activity=\think\Loader::model('Activity');
    $data['activityType'] = $activity->getActivityTyle();
    $page = input('page',1,'int');
    $count = input('count',10,'int');
    $type = input('type',0,'int');
    $searchKey  = input('searchKey',null,'string');
    $beginTime  = input('beginTime',null,'date');
    $endTime  = input('endTime',null,'date');
    $searchKey = urldecode($searchKey);
    $data['list'] = $activity->getHallList($page,$count,$type,$searchKey,$beginTime,$endTime);
    $data['searchInfo']= array('searchKey'=>$searchKey,'beginTime'=>$beginTime,'endTime'=>$endTime,'type'=>$type);
   // return \think\Db::getLastSql();
    return view(null,$data);
    }
    public function del()
    {
    $activityId = input('activityId',null,'string');
    $activity=\think\Loader::model('Activity');
    if($activityId)
    {
     $activity->delete($activityId);
    }
    return json(array('status'=>0));
    }
    public function submit()
    {
    $activity=\think\Loader::model('Activity');
    $Title = input('post.Title',null,'string');
    $activityType =input('post.activityType',null,'int');
    $content = input('post.content',0,'string');
    $imageData = input('post.imageData',null,'string');
    $industryId = input('post.industryId',0,'string');
    $cityId = input('post.cityId',0,'string');
    $educationalType = input('post.educationalType',0,'int');
    $salaryType = input('post.salaryType',1,'int');
    $experienceType = input('post.experienceType',0,'int');
    $jobsType = input('post.jobsType',0,'int');
    $sponsorUid = input('post.jobsType',10600,'int');
    $days =  input('post.days',30,'int');
    $sponsorUid = input('post.sponsorUid',10600,'int');
     $activityId =  $activity->release($Title,$activityType,$content,$imageData,$industryId,$cityId,$educationalType,$salaryType,$experienceType,$jobsType,$sponsorUid,$days);
     return array('status'=>1,'activityId'=>$activityId);
 //  return array('status'=>1,'activityId'=>'1234567890');
    }

}
